<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            //设置用户的主键ID
            $table->increments('id');
            //设置用户名字段
            $table->string('username')->comment('昵称');
            //用户email字段
            $table->string('email')->unique()->comment('email账号');
            //用户密码字段
            $table->string('password')->comment('密码');
            //账号激活判定
            $table->tinyInteger('status')->unsigned()->default(0)->comment('判断账户是否激活');
            //用户权限字段，不能为负，默认为4
            $table->tinyInteger('aadmin_id')->unsigned()->default(4)->comment('用户权限');
            //添加email验证字段
            $table->string('email_token')->comment('邮箱token值，用于后面激活账号使用');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
